﻿//
// Source: Rob Conery - http://blog.wekeroad.com/2007/12/10/aspnet-mvc-pagedlistt/
// MvcPager：mike108mvp  -  http://mike108mvp.cnblogs.com
//

using System.Collections.Generic;
using System.Linq;
using System;

namespace Longtop.Web.Helpers {
    public static class StringExtensions {
        public static string Limit(this string source, int length, string flag) {
            if (string.IsNullOrEmpty(source)) return source;
            return source.Length > length ? (source.Substring(0, length) + (flag ?? "..")) : source;
        }
        public static string Limit(this string source, int length) {
            return source.Limit(length, null);
        }

        public static bool IsEmpty(this string source) {
            return string.IsNullOrEmpty(source);
        }
        public static bool IsNotEmpty(this string source) {
            return !source.IsEmpty();
        }
    }
}